export function toObject(str) {
  console.log('toObject', JSON.parse(str));
  try {
    if (typeof str === 'object') return str;
    return JSON.parse(str);
  } catch (e) {
    return {};
  }
}

/**
 * 防抖
 */
let timeout = null;

export function debounce(func, delay = 200) {
  clearTimeout(timeout);
  timeout = setTimeout(() => {
    func();
  }, delay);
}

export { EventEmitter } from './event-bus';
export { deviceId } from './device-id';

export { default as NumberIDGenerator } from './id-gen';
